package common.library.utils;

import android.app.Activity;
import android.widget.Button;

import androidx.annotation.IdRes;
import common.library.models.Callback;

public class ButtonUtil {

    public static Button getButton(Activity activity, @IdRes int id) {
        return (Button) ViewUtil.getById(activity, id);
    }

    public static void addListener(Activity activity, @IdRes int id, Callback callback) {
        ViewUtil.addClickListener(activity, id, callback);
    }

    public static void addQuitListener(Activity activity, @IdRes int id) {
        ViewUtil.addClickListener(getButton(activity, id), () -> ApplicationUtil.quit());
    }

}
